from pydub import AudioSegment
from pydub.silence import split_on_silence
import sys
import os
import time

name = "01.wav"
sound = AudioSegment.from_wav(name)
silence_thresh=-7           # 小于-7dBFS以下的为静默
min_silence_len=120         # 静默超过120毫秒则拆分
length_limit=60*1000        # 拆分后每段不得超过1分钟
abandon_chunk_len=500       # 放弃小于500毫秒的段
joint_silence_len=1300      # 段拼接时加入1300毫秒间隔用于断句

chunk = split_on_silence(sound,min_silence_len=min_silence_len,silence_thresh=silence_thresh)
